

use "$data/survey1_clean.dta", clear

global control male age_* log_inc log_inc_sq highschool college working student democrat republican 


   *** Worries***

loc experiments "z_worry_corona_econ z_worry_perecon"
		   
			   
preserve 

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore


/* Statistics */

loc colnum = 1
loc colnames ""

global output_coeff ""
global output_se ""
global output_name""

foreach choice in `experiments' {

/* Statistics */

	


reg `choice'_update  1.contagiontreatment 1.contagiontreatment#1.lowhmort   `choice' , vce(r)
 
    sigstar 1.contagiontreatment, prec(4)
    estadd loc thisstat3 = "`r(bstar)'": col`colnum'
    estadd loc thisstat4 = "`r(sestar)'": col`colnum'
	
	sigstar `choice', prec(4)
    estadd loc thisstat9 = "`r(bstar)'": col`colnum'
    estadd loc thisstat10 = "`r(sestar)'": col`colnum'
	
	sigstar 1.contagiontreatment#1.lowhmort, prec(4)
    estadd loc thisstat6 = "`r(bstar)'": col`colnum'
    estadd loc thisstat7 = "`r(sestar)'": col`colnum'


    estadd loc thisstat12 =  string(`e(r2)', "%9.2f"): col`colnum'
	qui sum `choice'_update  
	estadd loc thisstat13 =  r(N): col`colnum'


reg `choice'_update 1.contagiontreatment 1.contagiontreatment#1.lowhmort `choice' $control, vce(r)
 
    sigstar 1.contagiontreatment, prec(4)
    estadd loc thisstat16 = "`r(bstar)'": col`colnum'
    estadd loc thisstat17 = "`r(sestar)'": col`colnum'
	
	sigstar `choice', prec(4)
    estadd loc thisstat22 = "`r(bstar)'": col`colnum'
    estadd loc thisstat23 = "`r(sestar)'": col`colnum'
	
	sigstar 1.contagiontreatment#1.lowhmort, prec(4)
    estadd loc thisstat19 = "`r(bstar)'": col`colnum'
    estadd loc thisstat20 = "`r(sestar)'": col`colnum'


    estadd loc thisstat25 =  string(`e(r2)', "%9.2f"): col`colnum'
	qui sum `choice'_update  
	estadd loc thisstat26 =  r(N): col`colnum'

	
    loc ++colnum
    loc colnames "`colnames' `"`: var la `choice''"'"

	


	} 
	

	

loc rowlabels " "{\bf Panel A: No control variables}"  "\midrule"  "Contagion information" " " " "  "Contagion information $\times$ Low relative mortality" " " " " "Baseline value" " " " " "\midrule R$^2$" " Number of Observations " "\midrule {\bf Panel B: Including control variables}" "\midrule" "Contagion information" " " " " "  Contagion information $\times$ Low relative mortality" " " " " "Baseline value" " " " "  "\midrule R$^2$" " Number of Observations " "\bottomrule""


loc rowstats ""

forval i = 1/26 {
    loc rowstats "`rowstats' thisstat`i'"
}

esttab * using "$tables/treatment_interaction_effects", replace cells(none) booktabs nonotes compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
   mtitle("US Economy" "Pers. Economic Sit."  ) ///
   mgroups("Worry about (standardized)" ,  pattern(1 0  1 0   ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))

